package model

type User struct {
	Name       string     `validate:"required"`
	Age        int        `validate:"gte=0,lte=100,adult"`
	Email      string     `validate:"email"`
	Password   string     `validate:"required,min=6"`
	RePassword string     `json:"re_password" binding:"required,eqfield=Password"`
	Addresses  []*Address `validate:"required,dive,required"` // dive 的语义在于告诉 validator 不要停留在我这一级，而是继续往下校验，无论是 slice, array 还是 map，校验要用的 tag 就是在 dive 之后的这个。
}

type Address struct {
	Street string `validate:"required"`
	City   string `validate:"required"`
	Planet string `validate:"required"`
	Phone  string `validate:"required"`
}
